import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/11 14:10
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String t = sc.nextLine();
            String[] words = t.split(" ");
            int len = words.length;
            String text = words[len - 2];
            int[] cnt = new int[128];
            for (char c: text.toCharArray()) {
                cnt[c]++;
            }
            int k = Integer.parseInt(words[len - 1]), n = Integer.parseInt(words[0]);
            List<String> list = new ArrayList<>();
            for (int i = 1; i <= n; i++) {
                if (words[i].length() != text.length()) {
                    continue;
                }
                if (!text.equals(words[i]) && match(words[i], cnt))  {
                    list.add(words[i]);
                }
            }
            Collections.sort(list);
            System.out.println(list.size());
            if (k <= list.size()) {
                System.out.println(list.get(k - 1));
            }
        }
    }
    public static boolean match(String s, int[] cnt) {
        int[] temp = new int[128];
        for (char c: s.toCharArray()) {
            temp[c]++;
        }
        for (int i = 0; i < 128; i++) {
            if (cnt[i] != temp[i]) {
                return false;
            }
        }
        return true;
    }
}
